<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员后台</title>
</head>
<body>
<h1>管理员后台</h1>
<p>
    管理员账号：<input type="text" id="useraccount" name="useraccount" placeholder="输入账号">
</p>
<p>
    管理员密码：<input type="password" id="userpwd" name="userpwd" placeholder="输入密码">
</p>
<P>
<input type="button" id="login" name="login" value="登录">
</P>

<script src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    var btn =document.getElementById("login");
    console.log(btn);
    btn.onclick=function () {
        var account = document.getElementById("useraccount").value;
        var password = document.getElementById("userpwd").value;

        var config={
            method:"get",
            url:"/managers?method=login&account="+account+"&pwd="+password,
            dataType:"json",
            success:function (resp) {
                console.log(resp);
                if(resp.code===1001){
                    window.location="index.html";
                }else if(resp.code===1002){
                    alert(resp.msg);
                }
            },
        };
        $.ajax(config);
    }


</script>
</body>
</html>